package MuleBackend;

/**
 * holds all the goods and money of a player.
 * In addition
 * @author Andrew
 *
 */
public class Inventory {
	int money;
	int food;
	int energy;
	int smithore;
	int crystite;
	int mule;
	static int totalMoney;
	static int totalFood;
	static int totalEnergy;
	static int totalSmithore;
	static int totalCrystite;
	
	public static final int NO_MULE=0;
	public static final int PLAIN_MULE=1;
	public static final int FOOD_MULE=2;
	public static final int ENERGY_MULE=3;
	public static final int SMITHORE_MULE=4;
	public static final int CRYSTITE_MULE=5;
	
	/**
	 * creates an inventory class;
	 * starting values will be placed in here. As of now, they are 0.
	 */
	public Inventory()
	{
		money=1000;
		food=5;
		energy=4;
		smithore=3;
		mule=0;
		totalMoney+=money;
		totalFood+=food+GameDriver.game.town.getFoodStock();
		totalEnergy+=energy+GameDriver.game.town.getEnergyStock();
		totalSmithore+=smithore+GameDriver.game.town.getSmithoreStock();
		totalCrystite+=crystite+GameDriver.game.town.getCrystiteStock();
		
	}
	
	/**
	 * sets the value of mule inside the
	 * inventory to be true or false
	 * (does a player own a mule)
	 * @param truth true if a player buys a mule
	 */
	public void setMule(int mule) { this.mule = mule; }
	
	/**
	 * gets the mule in the player's inventory
	 * @return the mule
	 */
	public int getMule() { return mule; }
	
	/**
	 * returns the money in the player's inventory
	 * @return the money the player has
	 */
	public int getMoney() { return money; }
	
	/**
	 * deducts a players money, either because of a purchase or because of an unfortunate event.
	 * @param deduction the amount of money the player loses
	 */
	public void deductMoney(int deduction) { 
		money -= deduction;
		totalMoney-=deduction;
	}

	/**
	 * adds money to the players wallet
	 * @param amount the amount of money to add
	 */
	public void addMoney(int amount) { 
		money += amount;
		totalMoney+=amount;
	}
	
	/**
	 * getter method for food
	 * @return food the food of the player
	 */
	public int getFood() { return food; }
	
	/**
	 * deduct food subtracts amount from current food
	 * @param amount amount to be subtracted
	 */
	public void deductFood(int amount) {
		/* Print statement */
		System.out.println("Deducted food " + amount);
		food -= amount;
		totalFood-=amount;
		System.out.println("Current food " + food);
	}
	
	/**
	 * adds/subtracts food
	 * @param amount
	 */
	public void addFood(int amount) {
		food+=amount;
		totalFood += amount;
	}
	/** 
	 * adds/subtracts  Energy
	 * @param amount 
	 */
	public void addEnergy(int amount) {
		energy+=amount;
		totalEnergy += amount;
	}
	/** 
	 * adds/subtracts  Smithore
	 * @param amount 
	 */
	public void addSmithore(int amount) {
		smithore+=amount;
		totalSmithore += amount;
	}
	/** 
	 * adds/subtracts  Crystite
	 * @param amount 
	 */
	public void addCrystite(int amount) {
		crystite+=amount;
		totalCrystite += amount;
	}
}
